package ru.mcfr.oxygen.framework.operations;

import ro.sync.ecss.extensions.api.*;
import ro.sync.ecss.extensions.api.node.AuthorDocumentFragment;

public class BreackLineOperation implements AuthorOperation {


    public void doOperation(AuthorAccess authorAccess, ArgumentsMap arg1) throws IllegalArgumentException, AuthorOperationException {
        AuthorDocumentController controller = authorAccess.getDocumentController();
        int currentOffset = authorAccess.getEditorAccess().getCaretOffset();
        AuthorDocumentFragment nf = null;

        try {
            nf = controller.createNewDocumentFragmentInContext("<с_новой_строки id=\"\"/>", currentOffset);
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        if (nf != null)
            authorAccess.getDocumentController().insertFragment(currentOffset, nf);

    }


    public ArgumentDescriptor[] getArguments() {
        // TODO Auto-generated method stub
        return null;
    }


    public String getDescription() {
        return "Вставить перенос на новую строку. <с_новой_строки/>";
    }

}
